package com.lifa.controller;

import com.lifa.dao.DianpuDao;
import com.lifa.entity.Dianpu;
import com.lifa.entity.Kucun;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/dianpu")
@Scope("prototype")
public class DianpuConrtoller {
    @Autowired
    public DianpuDao dianpuDao;

    @RequestMapping("/Dianpu1")
    @ResponseBody
    public List<Dianpu> Dianpu1(){

        return dianpuDao.selectDianpu();
    }

    @RequestMapping("/dianpufenye1")
    @ResponseBody
    public Map<String,Object> dianpufenye1( int offset, int limit){
        Map<String,Object> map=new HashMap<>();
        map.put("rows",dianpuDao.Dianpufenye(offset,limit));
        map.put("total",dianpuDao.Dianpuzongtiaoshu());
        return map;
    }
}
